package com.cloudsigns.factorymanager2.engineering.presenter;

import com.cloudsigns.factorymanager2.engineering.IView.IEngineeringInstallCompleteForManagerView;
import com.cloudsigns.factorymanager2.engineering.model.EngineeringInstallCompleteForManagerModel;
import com.cloudsigns.factorymanager2.engineering.model.IEngineeringInstallCompleteForManagerModel;

/**
 * Created by tony on 2018/6/9.
 */

public class EngineeringInstallCompleteForManagerPresenter {
    private IEngineeringInstallCompleteForManagerView view;
    private IEngineeringInstallCompleteForManagerModel model;
    private android.os.Handler mHandler = new android.os.Handler();

    public EngineeringInstallCompleteForManagerPresenter(IEngineeringInstallCompleteForManagerView view) {
        this.view = view;
        this.model = new EngineeringInstallCompleteForManagerModel();
    }

    public void engineeringInstallCompleteForManager() {


        model.engineeringInstallCompleteForManager(view.getOrderId(),new EngineeringInstallCompleteForManagerModel.OnEngineeringInstallCompleteForManagerListener() {
            @Override
            public void engineeringInstallCompleteForManagerSuccessed() {
                //需要在UI线程执行
                mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        view.engineeringInstallCompleteForManagerSuccessed();
                        view.hideLoading();
                    }
                });
            }

            @Override
            public void engineeringInstallCompleteForManagerFailed(final String desc) {
                mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        view.engineeringInstallCompleteForManagerFailed(desc);
                        view.hideLoading();
                    }
                });
            }


        });
    }


}
